<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
        <a-row>
          <a-col :span="24">
            <a-form-model-item label="产品名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productName">
              <a-input v-model="model.productName" placeholder="请输入产品名称"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="产品上市时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="timeToMarket">
              <j-date placeholder="请选择产品上市时间" v-model="model.timeToMarket" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="持续供货时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="supplyTime">
              <a-input v-model="model.supplyTime" placeholder="请输入持续供货时间"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="供货量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="supplyQuantity">
              <a-input v-model="model.supplyQuantity" placeholder="请输入供货量"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="供应时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="availableTime">
              <a-input v-model="model.availableTime" placeholder="请输入供应时间"></a-input>
            </a-form-model-item>
          </a-col>

        </a-row>
      </a-form-model>
    </j-form-container>
  </a-spin>
</template>

<script>

import { validateDuplicateValue } from '@/utils/util'
import { getAction, postAction, putAction } from '../../../api/manage'

export default {
  name: 'ZzzsRecordOfSupplyAbilityForm',
  components: {
  },

  props: {
    certificateId: "",
    //表单禁用
    disabled: {
      type: Boolean,
      default: false,
      required: false
    },
    id: ""
  },
  data() {
    return {
      model: {
      },
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      confirmLoading: false,
      validatorRules: {
      },
      url: {
        add: "/modules/zzzsRecordOfSupplyAbility/add",
        edit: "/modules/zzzsRecordOfSupplyAbility/edit",
        queryById: "/modules/zzzsRecordOfSupplyAbility/queryById",
        certificateUrl: "/modules/zzzsCertificate/getCertificate",
        changeUrl: "/modules/zzzsRecordOfSupplyAbility/change"

      },


    }
  },
  computed: {
    formDisabled() {
      return this.disabled
    },
  },
  created() {
    console.log(this.id)
    //备份model原始值

    this.getInfo()

  },
  methods: {

    edit(id) {
      console.log(id)
    },
    change() {
      console.log("调用了")
      putAction(this.url.changeUrl, this.model).then(res => {
        console.log(2)
        this.$emit("close")
      })
    },
    getInfo() {
      getAction(this.url.queryById, { id: this.id }).then(res => {
        this.model = res.result
      })
    }


  }
}
</script>